/*****************
* Macro define
*****************/
#define BLOCK_SIZE 512/*limit block size to 512 byte*/
#define NAME_SIZE 8  /*limit name size to 8 char*/
#define FILE_BLOCK_MAX_NUM 10/*limit max block num of one file*/
#define INDEX_NODE_MAX_NUM 100/**/
#define DIR_NODE_MAX_NUM 10000/**/
#define DATA_NODE_MAX_NUM 1000/**/

/*****************
* typedef define
*****************/
typedef unsigned int UINT32
typedef char BOOL_T;
typedef char CHAR;
typedef 1 TRUE;
typedef 0 FALSE;
typedef struct tagStDataBlock stDataBlockNode;
typedef struct tagStDirectBlock stDirectBlockNode;
typedef struct tagStDirectItem stDirectItem;
typedef struct tagStIndexNode stIndexNode;

/*****************
* Global Variable define
*****************/
/*iNode Table*/
stIndexNode *apstiNodeTable[INDEX_NODE_MAX_NUM] = {0};
stDirectBlockNode *apstDirTable[DIR_NODE_MAX_NUM] = {0};
stDataBlockNode *apstDataTable[DATA_NODE_MAX_NUM] = {0};

/********************
* Data structure define
********************/
/*Index Node*/
struct stIndexNode
{
	UINT32 uiIndex;/*used by iNode table*/
	stDataBlock *apstDataBlock[FILE_BLOCK_MAX_NUM];/*file max size = 512 * 10 byte*/		
}tagStIndexNode;

/*Data Block*/
struct stDataBlock
{
	UINT32 uiIndex;/*used by dBlock table*/
	CHAR acData[BLOCK_SIZE];/*map buffer*/
}tagStDataBlock;

/*Directory Block*/
struct stDirectBlock
{
	UINT32 uiIndex;/*used by dBlock table*/
	CHAR azName[NAME_SIZE];/*directory name*/
	stDirectItem  astDirItem[2];/*.and..*/
}tagStDirectBlock;

/*Directory Item*/
struct stDirectItem
{
	UINT32 uiIndex;/*iNode index*/
	CHAR azName[NAME_SIZE];/*directory or file name*/
	BOOL   bIsFile;/*true == file name*/
	UCHAR ucReserve[1]; /*for align*/
}tagStDirectItem;


/*Super Block*/
struct stSuperBlock
{
	//TODO:define some useful info
}tagStSuperBlock;

